package com.wuxiaofan.service;

import com.wuxiaofan.entity.model.DepartmentMongo;
import com.wuxiaofan.repository.DepartmentRepository;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;

/**
 * @author wuxiaofan
 * @date 2021/11/2 8:59 上午
 */
@Service
public class DepartmentService {
    @Resource
    private DepartmentRepository departmentRepository;


    public void save(DepartmentMongo departmentMongo){
        departmentRepository.save(departmentMongo);
    }

    public void batchSave(List<DepartmentMongo> departmentMongos){
        departmentRepository.saveAll(departmentMongos);
    }


    public List<DepartmentMongo> all(String hoscode){
        List<DepartmentMongo> departmentMongoList = departmentRepository.findByHoscode(hoscode);
        return departmentMongoList;
    }

    public void deleteById(String id){
        departmentRepository.deleteById(id);
    }

}
